package singleton;

/**
 * @author wcj
 * @Date 2021/6/19 20:05
 * @Version 1.0
 */
public class DclSingleton {

 private static volatile DclSingleton singleton = null;

 private DclSingleton() {
 }

 /**
  * DCL双检锁单例模式
  *
  * @return
  */
 public static DclSingleton getSingleton() {
  if (singleton == null) {
   synchronized (DclSingleton.class) {
    if (singleton == null) {
     singleton = new DclSingleton();
    }
   }
  }
  return singleton;
 }
}
